package com.IO流.处理流.PrintWriter__打印流;

import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;

public class PrintWriter__ {
    public static void main(String[] args) throws IOException {
        //public PrintWriter(OutputStream out)  打印位置
        PrintWriter pr = new PrintWriter(System.out);
        pr.write("这是打印到显示器控制台的内容");
        pr.close();
        //public PrintWriter(Writer out)    打印位置也可以是一个文件
        String filename = "D:/JAVA_test/PrintWriter.txt";
        PrintWriter pr2 = new PrintWriter(new FileWriter(filename));
        pr2.write("这是打印到文件中的内容");
        pr2.close();
    }
}
